<?php

class Privilege extends CActiveRecord
{
    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }

    public function tableName()
    {
        return '{{privileges}}';
    }

	public function relations() {
		return array(
			//'usergroup' => array(self::BELONGS_TO, 'Usergroup', 'usergroup_id'),
		);
	}

	public function rules()
	{
		return array(

		);
	}

	/**
	 * Declares attribute labels.
	 */
	public function attributeLabels()
	{
		return array(
			//'rememberMe'=>'Remember me next time',
		);
	}

	public function findAllPrivileges() {
		$_privileges = $this->findAll();
		$privileges = array();
		foreach ($_privileges as $pri) {
			$privileges[$pri->section][] = $pri;
		}

		return $privileges;
	}
}
?>